<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="dialog-layout">
	<tiles:putAttribute name="head">
		<style type="text/css">
#selColors option {
	padding: 0.2em;
	margin: 0.2em;
}

.courseType {
	padding: 0.4em;
}
</style>
		<script type="text/javascript">
			$(function() {
				$("#selColors").change(function() {
					if (!this.value) {
						$(this).removeClass();
					} else {
						$(this).toggleClass(this.value);
					}
				});

				$("#btnReset").click(function() {
					$("#selColors").val("");
					$("#selColors").removeClass();

					return false;
				});

				$(".confirm").confirmDialog(function(data) {
					helper.showMsg(data, {
						okHandler : function() {
							art.dialog.data("success", true);
							art.dialog.close();
						}
					});
				});

				$("form").Validform({
					ajaxPost : true,
					tiptype : ValidUtils.siblingTip,
					callback : function(data) {
						helper.showMsg(data, {
							okHandler : function() {
								art.dialog.data("success", true);
								art.dialog.close();
							}
						});
					}
				});
			});
		</script>
	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<form class="form-horizontal" action="doModifyCourseType" method="post">
			<fieldset>
				<legend>修改课程类型</legend>
			</fieldset>
			<div class="control-group">
				<input type="hidden" name="id" value="${courseType.id}" />
				<div class="control-group">
					<div class="control-label">类型名称</div>
					<div class="controls">
						<input type="text" name="name" value="${courseType.name}" />
					</div>
				</div>
				<div class="control-group">
					<div class="control-label">类型说明</div>
					<div class="controls">
						<input type="text" name="title" value="${courseType.title}" />
					</div>
				</div>
				<div class="control-group">
					<div class="control-label">颜色标记</div>
					<div class="controls">
						<s:select name="cssClass" list="colors" value="#courseType.cssClass" headerKey="''" headerValue="不标色"></s:select>
						<button title="无颜色" id="btnReset">
							<i class="icon-repeat"></i>
						</button>
					</div>
				</div>
				<div class="controls">
					<button class="btn btn-primary">修改课程类型</button>

					<s:url namespace="/coursetype" action="doRemoveCourseType" id="doRemoveCourseType">
						<s:param name="id" value="#courseType.id"></s:param>
					</s:url>
					<a href="${doRemoveCourseType}" class="btn confirm" title="删除当前课程类型">
						<i class="icon-minus"></i>删除
					</a>
				</div>
			</div>
		</form>
	</tiles:putAttribute>
</tiles:insertDefinition>